﻿using System;
using System.Linq.Dynamic;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Buffalo.Lib.Common;
using Ext.Net.MVC;
using Ext.Net;
using System.Web.Mvc;
using Buffalo.SMECommon.DAL.Models;
using System.Data.Linq;
using System.Collections;
using System.Linq.Expressions;

namespace Buffalo.SMECommon.DAL
{
    public class CatalogDAL : BaseDAL
    {
        #region Bank
        public List<Bank> GetListBank(int limit, int start, string dir, string sort, string criteria, string searchText, out int total)
        {
            return GetListEntity<Bank>("gc_Bank", string.Empty, limit, start, dir, sort, criteria, searchText, out total);
        }
        public bool SaveBanks(string jsonData)
        {
            return SaveEntities<Bank>(jsonData, new string[] { "Code", "Name" });
        }
        #endregion
        #region PartnerCategory
        public List<PartnerCategory> GetListPartnerCategory(int limit, int start, string dir, string sort, string criteria, string searchText, out int total)
        {
            return GetListEntity<PartnerCategory>("gc_PartnerCategory", string.Empty, limit, start, dir, sort, criteria, searchText, out total);
        }
        public bool SavePartnerCategories(string jsonData)
        {
            return SaveEntities<PartnerCategory>(jsonData, new string[] { "Code", "Name" });
        }
        #endregion
        #region PaymentType
        public List<PaymentType> GetListPaymentType(int limit, int start, string dir, string sort, string criteria, string searchText, out int total)
        {
            return GetListEntity<PaymentType>("gc_PaymentType", string.Empty, limit, start, dir, sort, criteria, searchText, out total);
        }
        public bool SavePaymentTypes(string jsonData)
        {
            return SaveEntities<PaymentType>(jsonData, new string[] { "Code", "Name" });
        }
        #endregion
        #region OrderType
        public List<OrderType> GetListOrderType(int limit, int start, string dir, string sort, string criteria, string searchText, out int total)
        {
            return GetListEntity<OrderType>("gc_OrderType", string.Empty, limit, start, dir, sort, criteria, searchText, out total);
        }
        public bool SaveOrderTypes(string jsonData)
        {
            return SaveEntities<OrderType>(jsonData, new string[] { "Code", "Name" });
        }
        #endregion



        #region Nation
        public List<Nation> GetListNation(int limit, int start, string dir, string sort, string criteria, string searchText, out int total)
        {
            return GetListEntity<Nation>("gc_Nation", string.Empty, limit, start, dir, sort, criteria, searchText, out total);
        }
        public bool SaveNations(string jsonData)
        {
            return SaveEntities<Nation>(jsonData, new string[] { "Code", "Name" });
        }
        #endregion

        #region Origin
        public List<Origin> GetListOrigin(int limit, int start, string dir, string sort, string criteria, string searchText, out int total)
        {
            return GetListEntity<Origin>("gc_Origin", string.Empty, limit, start, dir, sort, criteria, searchText, out total);
        }
        public bool SaveOrigins(string jsonData)
        {
            return SaveEntities<Origin>(jsonData, new string[] { "Code", "Name" });
        }
        #endregion

        #region Religion
        public List<Religion> GetListReligion(int limit, int start, string dir, string sort, string criteria, string searchText, out int total)
        {
            return GetListEntity<Religion>("gc_Religion", string.Empty, limit, start, dir, sort, criteria, searchText, out total);
        }
        public bool SaveReligions(string jsonData)
        {
            return SaveEntities<Religion>(jsonData, new string[] { "Code", "Name" });
        }
        #endregion

        #region PaymentTerm
        public List<PaymentTerm> GetListPaymentTerm(int limit, int start, string dir, string sort, string criteria, string searchText, out int total)
        {
            return GetListEntity<PaymentTerm>("gc_PaymentTerm", string.Empty, limit, start, dir, sort, criteria, searchText, out total);
        }
        public bool SavePaymentTerms(string jsonData)
        {
            return SaveEntities<PaymentTerm>(jsonData, new string[] { "Code", "Name" });
        }
        #endregion

        #region Position
        public List<Position> GetListPosition(int limit, int start, string dir, string sort, string criteria, string searchText, out int total)
        {
            return GetListEntity<Position>("gc_Position", string.Empty, limit, start, dir, sort, criteria, searchText, out total);
        }
        public bool SavePositions(string jsonData)
        {
            return SaveEntities<Position>(jsonData, new string[] { "Code", "Name" });
        }
        #endregion

        #region School
        public List<School> GetListSchool(int limit, int start, string dir, string sort, string criteria, string searchText, out int total)
        {
            return GetListEntity<School>("gc_School", string.Empty, limit, start, dir, sort, criteria, searchText, out total);
        }
        public bool SaveSchools(string jsonData)
        {
            return SaveEntities<School>(jsonData, new string[] { "Code", "Name" });
        }
        #endregion

        #region SalaryFactor
        public List<SalaryFactor> GetListSalaryFactor(int limit, int start, string dir, string sort, string criteria, string searchText, out int total)
        {
            return GetListEntity<SalaryFactor>("gc_SalaryFactor", string.Empty, limit, start, dir, sort, criteria, searchText, out total);
        }
        public bool SaveSalaryFactors(string jsonData)
        {
            return SaveEntities<SalaryFactor>(jsonData, new string[] { "GradeCode", "GradeName" });
        }
        #endregion

        #region SalesMethod
        public List<SalesMethod> GetListSalesMethod(int limit, int start, string dir, string sort, string criteria, string searchText, out int total)
        {
            return GetListEntity<SalesMethod>("gc_SalesMethod", string.Empty, limit, start, dir, sort, criteria, searchText, out total);
        }
        public bool SaveSalesMethods(string jsonData)
        {
            return SaveEntities<SalesMethod>(jsonData, new string[] { "Code", "Name" });
        }
        #endregion

        #region ShippingMethod
        public List<ShippingMethod> GetListShippingMethod(int limit, int start, string dir, string sort, string criteria, string searchText, out int total)
        {
            return GetListEntity<ShippingMethod>("gc_ShippingMethod", string.Empty, limit, start, dir, sort, criteria, searchText, out total);
        }
        public bool SaveShippingMethods(string jsonData)
        {
            return SaveEntities<ShippingMethod>(jsonData, new string[] { "Name", "Price" });
        }
        #endregion

        #region Country
        public List<Country> GetListCountry(int limit, int start, string dir, string sort, string criteria, string searchText, out int total)
        {
            return GetListEntity<Country>("gc_Country", string.Empty, limit, start, dir, sort, criteria, searchText, out total);
        }
        public bool SaveCountries(string jsonData)
        {
            return SaveEntities<Country>(jsonData, new string[] { "Code", "Name" });
        }
        #endregion

        #region Industry 
        public List<Industry> GetListIndustry (int limit, int start, string dir, string sort, string criteria, string searchText, out int total)
        {
            return GetListEntity<Industry>("gc_Industry", string.Empty, limit, start, dir, sort, criteria, searchText, out total);
        }
        public bool SaveIndustries(string jsonData)
        {
            return SaveEntities<Industry>(jsonData, new string[] { "Code", "Name" });
        }
        #endregion

        #region Currency
        public List<Currency> GetListCurrency(int limit, int start, string dir, string sort, string criteria, string searchText, out int total)
        {
            return GetListEntity<Currency>("gc_Currency", string.Empty, limit, start, dir, sort, criteria, searchText, out total);
        }
        public bool SaveCurrencies(string jsonData)
        {
            return SaveEntities<Currency>(jsonData, new string[] { "Code", "Name" });
        }
        #endregion
    }
}
